package com.baitengsoft.patentservicemonitor.api.service.impl;

import com.baitengsoft.patentservicemonitor.api.dao.RptPatentDataAreaDao;
import com.baitengsoft.patentservicemonitor.api.entity.RptPatentDataAreaEntity;
import com.baitengsoft.patentservicemonitor.api.model.RptPatentDataAreaModel;
import com.baitengsoft.patentservicemonitor.api.service.RptPatentDataAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * Created by 周俊 on 2017/12/14.
 */
@Service("RptPatentDataAreaService")
public class RptPatentDataAreaImpl implements RptPatentDataAreaService {
    @Autowired
    private RptPatentDataAreaDao rptPatentDataAreaDao;

    /**
     * 插入一行数据
     */
    @Override
    @Transactional
    public void addorUpdateRptPatentDataAreaInfo(RptPatentDataAreaEntity rptPatentDataAreaEntity) {
        if (rptPatentDataAreaEntity.getID() > 0) {//更新数据
            rptPatentDataAreaDao.update(rptPatentDataAreaEntity);
        } else {//插入数据
            rptPatentDataAreaDao.save(rptPatentDataAreaEntity);
        }
    }

    /**
     * 获取RptPatentDataArea表对应数据数量
     */
    @Override
    public int getRptPatentDataAreaCount(Integer AreaID,Integer DateYM,Integer PlatformID) {
        int count = rptPatentDataAreaDao.getRptPatentDataAreaCount(AreaID, DateYM, PlatformID);
        return count;
    }

    /**
     * 获取RptPatentDataArea表对应数据
     */
    @Override
    public RptPatentDataAreaEntity queryRptPatentDataAreaByQuery(Integer AreaID,Integer DateYM,Integer PlatformID) {
        RptPatentDataAreaEntity entity = rptPatentDataAreaDao.queryRptPatentDataAreaByQuery(AreaID,DateYM,PlatformID);
        return entity;
    }
}
